#!/bin/bash

#sync the tookit submodules to the same branch (maint/master)
#this updates the submodules to match the top level project

if [ -z "$1" ]; then
    BRANCH=$(git rev-parse --abbrev-ref HEAD)
    echo "Current branch: ${BRANCH}"
else
    BRANCH=$1
    echo "Sync branch: ${BRANCH}"
fi

TOOLKITS="
audio
blocks
comms
flow
plotters
python
soapy
widgets
"

for TOOLKIT in ${TOOLKITS}; do
    echo "Syncing ${TOOLKIT}..."
    git -C ${TOOLKIT} checkout ${BRANCH}
    git -C ${TOOLKIT} pull origin ${BRANCH}
done

echo "Done!"
